<template>
  <div class="header">
    <div class="go">
      <span class="iconfont left" @click="backOff()">&#xe636;</span>
      <span class="iconfont right" @click="backGo()">&#xe635;</span>
    </div>
    <div class="docu">
      <span class="root" @click="backRoot">根目录</span>
      <span class="doc">文档</span>
      <span class="design">设计稿</span>
    </div>
    <div class="searchWrapper">
      <div class="search"></div>
      <span class="iconfont">&#xe662;</span>
    </div>

    <div class="tabs">
      <div
        class="tabsLeft"
        :class="{ ' active': this.$store.state.changeShow.showWay == 'list' }"
        @click="listWay"
      >
        <span class="iconfont list"> &#xe673;</span>
      </div>
      <div
        class="tabsRight"
        :class="{ ' active': this.$store.state.changeShow.showWay == 'grid' }"
        @click="gridWay"
      >
        <span class="iconfont grid"> &#xe60e;</span>
      </div>
    </div>
  </div>
</template>

<script>
import "../../iconfont/iconfont.css";
export default {
  name: "headerComponent",
  data() {
    return {
      Path: "",
    };
  },
  methods: {
    listWay() {
      this.$store.commit("listWay", "list");
    },
    gridWay() {
      this.$store.commit("gridWay", "grid");
    },
    backRoot() {
      this.$store.dispatch("backRoot");
    },
    backOff() {
      console.log(this.$store.state.documents.get.path.peek());

      this.$store.dispatch(
        "backOff",
        this.$store.state.documents.get.path.peek()
      );
    },
    backGo() {
      this.$store.dispatch(
        "backGo",
        this.$store.state.documents.get.goPath.peek()
      );
    },
  },
  mounted() {
    this.$root.$on("Path", (data) => {
      this.Path = data;
    });
  },
};
</script>
<style lang="less" scoped>
//头部导航栏
.header {
  display: flex;
  position: relative;
  margin: 0 auto;
  width: 100%;
  height: 60px;
  align-items: center;

  //前进后退
  .go {
    flex: 1;
    margin-left: 10px;
    padding: 1px;
    overflow: hidden;
    //矢量图标
    .left {
      font-family: "iconfont" !important;
      font-style: normal;
      color: #fff;
      font-size: 39px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      cursor: pointer;
    }

    .right {
      margin-left: 0.365vw;
      font-family: "iconfont" !important;
      font-style: normal;
      color: #fff;
      font-size: 39px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      cursor: pointer;
    }
  }
  //文档种类
  .docu {
    flex: 6;
    //根目录
    .root {
      float: left;
      margin-right: 3px;
      padding: 5px 5px 5px 9px;
      border-radius: 29px 0 0 29px;
      background: rgba(255, 255, 255, 0.29);
      color: rgba(255, 255, 255, 100);
      font-size: 18px;
      text-align: center;
      font-family: Roboto;
      cursor: pointer;
    }
    //中间目录
    .doc {
      float: left;
      margin-right: 3px;
      padding: 5px 5px 5px 5px;
      background: rgba(255, 255, 255, 0.29);
      color: rgba(255, 255, 255, 100);
      font-size: 18px;
      text-align: center;
      font-family: Roboto;
      cursor: pointer;
    }
    //当前目录
    .design {
      float: left;
      padding: 5px 9px 5px 5px;

      border-radius: 0 29px 29px 0;
      background: rgba(255, 255, 255, 0.29);
      color: rgba(255, 255, 255, 100);
      font-size: 18px;
      text-align: center;
      font-family: Roboto;
      cursor: pointer;
    }
  }

  //搜索框
  .searchWrapper {
    position: relative;
  }

  @media screen and (max-width: 900px) {
    .tabs {
      display: none;
    }
  }
  .tabs {
    flex: 1;
    // 选择显示种类
    .tabsLeft {
      float: left;
      width: 48px;
      height: 35px;
      line-height: 35px;
      border-radius: 9.999px;
      color: rgba(16, 16, 16, 100);
      font-size: 13.999px;
      text-align: center;
      font-family: Roboto;
      cursor: pointer;
      //列表的矢量图标
      .list {
        font-family: "iconfont" !important;
        font-style: normal;
        color: #ffffff;
        font-size: 24px;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
      }
    }

    .tabsRight {
      float: left;
      width: 48px;
      height: 35px;
      line-height: 35px;
      border-radius: 9.999px;
      color: rgba(16, 16, 16, 100);
      font-size: 13.999px;
      text-align: center;
      font-family: Roboto;
      cursor: pointer;
      //网格的矢量图标
      .grid {
        font-family: "iconfont" !important;
        font-style: normal;
        color: #ffffff;
        font-size: 24px;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
      }
    }

    //点击高亮
    .active {
      background-color: rgba(255, 255, 255, 0.36);
    }
  }
}
</style>